package com.ybxx.hr.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.ybxx.core.command.QueryFilter;
import com.ybxx.core.dao.GenericDao;
import com.ybxx.core.service.impl.BaseServiceImpl;
import com.ybxx.core.web.paging.PagingBean;
import com.ybxx.hr.dao.DeptDao;
import com.ybxx.hr.model.Dept;
import com.ybxx.hr.model.HrUser;
import com.ybxx.hr.service.DeptService;

public class DeptServiceImpl extends BaseServiceImpl<Dept> implements
		DeptService {
	private DeptDao deptDao;
	public DeptServiceImpl(DeptDao dao) {
		super(dao);
		this.deptDao=dao;
		// TODO Auto-generated constructor stub
	}
	public List<Dept> queryPage(Dept dept,QueryFilter filter) {
		String hql="from Dept d";
		String condition=" where ";
		if(dept!=null && StringUtils.isNotEmpty(dept.getDname())){
			hql+=condition+" d.dname='"+dept.getDname()+"' ";
		}
		return deptDao.findByHql(hql, null,filter.getPagingBean());
	}
}
